From: Julien Grall Date: Wed, 27 Jul 2016 13:58:26 +0000 (+0100) Subject: xen/arm: gic: Document how gic_set_irq_type should be called X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~681 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=84e8aaa5a0cd59f774cada9b04fb6db4512f8692;p=xen.git xen/arm: gic: Document how gic_set_irq_type should be called Changing the value of Int_config is UNPREDICTABLE when the corresponding interrupt is not disabled. The driver is assuming the interrupt will be disabled by the caller of gic_set_irq_type. Add an ASSERT to ensure it. Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index b9371a7637..72bb885d8d 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -96,8 +96,14 @@ void gic_restore_state(struct vcpu *v) gic_restore_pending_irqs(v); } +/* desc->irq needs to be disabled before calling this function */ static void gic_set_irq_type(struct irq_desc *desc, unsigned int type) { + /* + * IRQ must be disabled before configuring it (see 4.3.13 in ARM IHI + * 0048B.b). We rely on the caller to do it. + */ + ASSERT(test_bit(_IRQ_DISABLED, &desc->status)); ASSERT(spin_is_locked(&desc->lock)); ASSERT(type != IRQ_TYPE_INVALID);